﻿/// <summary>
/// Implements AstroBodyDesc class.
/// </summary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.Reflection;
using SpaceSim.External;

namespace SpaceSim
{
    /// <summary>
    /// Defines the generic properties of a potential astrophysics body
    /// </summary>
    [Serializable]
    public class AstroBodyDesc : Modifiable
    {
        public AstroBodyDesc()
        {
            Name = null;
            Probability = -1.0;
            Radius = -1.0;
            Mass = -1.0;
            Primary = false;
        }

        /// <summary>
        /// Name, or type, for this AstroBodyDesc. Example, "Black hole" or "Debris disk".
        /// </summary>
        [XmlAttribute()]
        public string Name { get; set; }

        /// <summary>
        /// Likelihood of an AstroBody of this type to show up in the simulation, where a higher
        /// value would be more likely and a lower value less so. There is no inherit max value
        /// to probablity, but a probablity of zero or less should never show up in the simulation.
        /// </summary>
        [XmlAttribute()]
        public double Probability { get; set; }

        /// <summary>
        /// Average radius of an AstroBody of this type in the simulation. Units are Solar Radii.
        /// </summary>
        [XmlAttribute()]
        public double Radius { get; set; }

        /// <summary>
        /// Average mass of an AstroBody of this type in the simulation. Units are Solar Masses.
        /// </summary>
        [XmlAttribute()]
        public double Mass { get; set; }

        /// <summary>
        /// True if an AstroBody of this type can be a system's primary.
        /// </summary>
        [XmlAttribute()]
        public bool Primary { get; set; }

        /// <summary>
        /// Delegate methods used to filter in or out of a list AstroBodyDescs that are system 
        /// primaries.
        /// </summary>
        public delegate bool Filter(AstroBodyDesc desc);
        static public bool PrimaryTrue(AstroBodyDesc desc) { return desc.Primary; }
        static public bool PrimaryFalse(AstroBodyDesc desc) { return !desc.Primary; }
    }
}
